// pages/sblimtMoney

import { Balance } from "../../../model/Balance"
Page({

  /**
   * 页面的初始数据
   */
  data: {
    money: 0.00,
    balance_icon:''
  },

  onLoad: async function (options) {
    
  },

  //生命周期函数--监听页面显示
  onShow: async function () {
    this.setData({
      money:wx.getStorageSync('Bmoney'),
      balance_icon:wx.getStorageSync('Bicon')
    })

    let balance = await Balance.get_user_balance();
    //执行 获取金额的自定义函数
    if (balance.code == 0) {
      this.setData({
        balance_icon:balance.data.balance_icon,
        money: balance.data.balance
      })
    } else {
      wx.showToast(balance.msg)
    }
  },
  

})